#include <stdio.h>

void gen_ext( int n )
{
    printf( "int exp%d( int x )\n{\n", n  );
    printf( "    int y = 1;\n");
    while ( n > 0 ) 
    {
        if ( n % 2 ) printf("    y = y*x;\n");
        n = n / 2;
        //printf("    n = n/2;\n");
        if ( n > 0 ) printf("    x = x*x;\n");
    }
    printf("    return y;\n}\n");
}

void main( int argc, char* argv[] )
{
    int n = atoi( argv[1] );
    gen_ext( n );
      
}



